//--------------------------------------------------------------------------------------------------
// Design    : DITF
// Author(s) : yinchengbin
// File      : V1._DITF.v
// Generated : 2021.7.12           
//-------------------------------------------------------------------------------------------------
// Description :
// DITF（Dispatched Instructions Table FIFO），派遣指令FIFO，记录当前派遣到执行单元执行的指令的信息。
// 记录了指令的PC、RS1_index、RS2_index、RD_index、CSRindex、以及指令的异常信息，以及最重要的：指令的ITAG。
// 这些信息被依次按顺序写入DITF表中，在读取的时候按顺序读出，
// 依此特性可以使指令的写回顺序与发射顺序一致，从而实现了流水线的动态调度。
// 表项深度为8
//-------------------------------------------------------------------------------------------------
`include "PRV564Config.v"
`include "PRV564Define.v"
module DITF(
//---------------Global Sognal--------------------
    input wire          DITFi_CLK,              //DITF Clock input, posedge trigged
    input wire          DITFi_ARST,             //DITF Async reset signal
	input wire 			DITFi_SRST,				//同步复位信号，在执行异常指令时起到冲刷DIFT的作用
//------------dependencies Check port---------------
    input wire          DITFi_Checken,          //check enable
    input wire [4:0]    DITFi_CheckRs1Index,    //rs1 index for check
    input wire          DITFi_CheckRs1en,       //rs1 index for check is enable
    input wire [4:0]    DITFi_CheckRs2Index,    //rs2 index for check
    input wire          DITFi_CheckRs2en,       //rs2 index for check is enable
    input wire [11:0]   DITFi_CheckCSRIndex,    //csr index for check
    input wire          DITFi_CheckCSRen,       //csr index for check is enable
    output wire         DITFo_DepdcFind,        //A dependencies is found
//---------------Write Port Signal------------------
	output wire			DITFo_write_ready,		//DIFT 未满可写入信号
    input wire          DITFi_write,            //Write enable (add a new entry)
    input wire [7:0]    DITFi_itag,
    input wire [4:0]    DITFi_rs1index,
    input wire          DITFi_rs1en,
    input wire [4:0]    DITFi_rs2index,
    input wire          DITFi_rs2en,
    input wire [4:0]    DITFi_rdindex,
    input wire          DITFi_rden,
    input wire [11:0]   DITFi_csrindex,
    input wire          DITFi_csren,
    input wire          DITFi_jmp,
    input wire          DITFi_InsAccessFlt,
    input wire          DITFi_InsPageFlt,
    input wire          DITFi_InsAddrMis,
    input wire          DITFi_illins,
    input wire          DITFi_mret,
    input wire          DITFi_sret,
    input wire          DITFi_ecall,
    input wire          DITFi_ebreak,
	input wire 			DITFi_system,
	input wire 			DITFi_fencevma,
	input wire 			DITFi_fencei,
	input wire 			DITFi_fence,
	
//--------------Read Port Signal--------------------
    input  wire          DITFi_remove,           //Remove a entry from DITF
    output wire          DITFo_v,
    output wire [7:0]    DITFo_itag,
    output wire [4:0]    DITFo_rs1index,
    output wire          DITFo_rs1en,
    output wire [4:0]    DITFo_rs2index,
    output wire          DITFo_rs2en,
    output wire [4:0]    DITFo_rdindex,
    output wire          DITFo_rden,
    output wire [11:0]   DITFo_csrindex,
    output wire          DITFo_csren,
    output wire          DITFo_jmp,
    output wire          DITFo_InsAccessFlt,
    output wire          DITFo_InsPageFlt,
    output wire          DITFo_InsAddrMis,
    output wire          DITFo_illins,
    output wire          DITFo_mret,
    output wire          DITFo_sret,
    output wire          DITFo_ecall,
    output wire          DITFo_ebreak,
	output wire          DITFo_system,
	output wire          DITFo_fencevma,
	output wire          DITFo_fencei,
	output wire          DITFo_fence
);

//------------------------------内部端口的定义---------------------------------
//DITF 寄存器组
	reg [51:0] r_DITF_data_0;
	reg [51:0] r_DITF_data_1;
	reg [51:0] r_DITF_data_2;
	reg [51:0] r_DITF_data_3;
	reg [51:0] r_DITF_data_4;
	reg [51:0] r_DITF_data_5;
	reg [51:0] r_DITF_data_6;
	reg [51:0] r_DITF_data_7;

//DITF_PC	DITF寄存器组指针
reg [3:0] DITF_cnt;  

//DITFo_DepdcFind 信号输出临时值
wire DITFo_DepdcFind_tem_Rs1;
wire DITFo_DepdcFind_tem_Rs2;
wire DITFo_DepdcFind_tem_CS;



//////////////////////////////////////////////////////////////////////////////////////////
//
//---------------------------信号值的更新---------------------------------------

//DITF_cnt	DITF寄存器组计数器
always@(posedge DITFi_CLK or posedge DITFi_ARST)begin
	if(DITFi_ARST)
		DITF_cnt <= 'd0;
	else if(DITFi_SRST)begin
		DITF_cnt <= 'd0;
	end
	else begin
		case({DITFi_write,DITFi_remove})
			2'b00	: DITF_cnt <= DITF_cnt;
			2'b01	: DITF_cnt <= DITF_cnt - 1'b1;
			2'b10	: DITF_cnt <= DITF_cnt + 1'b1;
			2'b11	: DITF_cnt <= DITF_cnt;
			default	;
		endcase
	end
end
//DITF 寄存器组
always@(posedge DITFi_CLK or posedge DITFi_ARST)
	if(DITFi_ARST) begin
		r_DITF_data_0 <= 'd0;
		r_DITF_data_1 <= 'd0;
		r_DITF_data_2 <= 'd0;
		r_DITF_data_3 <= 'd0;
		r_DITF_data_4 <= 'd0;
		r_DITF_data_5 <= 'd0;
		r_DITF_data_6 <= 'd0;
		r_DITF_data_7 <= 'd0;
		end
	else if(DITFi_write) begin
		r_DITF_data_0 <= {	DITFi_fence,
							DITFi_fencei,
							DITFi_fencevma,
							DITFi_system,
							DITFi_ebreak,
							DITFi_ecall,
							DITFi_sret,
							DITFi_mret,
							DITFi_illins,
							DITFi_InsAddrMis,
							DITFi_InsPageFlt,
							DITFi_InsAccessFlt,
							DITFi_jmp,
							DITFi_csren,
							DITFi_csrindex[11:0],
							DITFi_rden,
							DITFi_rdindex[4:0],
							DITFi_rs2en,
							DITFo_rs2index[4:0],
							DITFi_rs1en,
							DITFi_rs1index[4:0],
							DITFi_itag[7:0]};
		r_DITF_data_1 <= r_DITF_data_0;
		r_DITF_data_2 <= r_DITF_data_1;
		r_DITF_data_3 <= r_DITF_data_2;
		r_DITF_data_4 <= r_DITF_data_3;
		r_DITF_data_5 <= r_DITF_data_4;
		r_DITF_data_6 <= r_DITF_data_5;
		r_DITF_data_7 <= r_DITF_data_6;
		end	
	else ;
	
//--------------------------------寄存器有效位掩码----------------------------------
reg [8:0] DIFT_MASK;
always@(posedge DITFi_CLK or posedge DITFi_ARST)
	if(DITFi_ARST)
		DIFT_MASK <= 9'b00000001;
	else if(DITFi_SRST)begin
		DIFT_MASK <= 9'b00000001;
	end
	else begin
		case({DITFi_write,DITFi_remove})
			2'b00	: DIFT_MASK <= DIFT_MASK;
			2'b01	: DIFT_MASK <= {1'b0,DIFT_MASK[8:1]};
			2'b10	: DIFT_MASK <= {DIFT_MASK[8:0],1'b1};
			2'b11	: DIFT_MASK <= DIFT_MASK;
			default	;
		endcase
	end

//---------------------------------------------------------------------------------------------------------------
//-------------------------------dependencies Check port---------------------------------------------------------
//
//为了简化组合逻辑电路，假定X0寄存器不会不需要比对

assign DITFo_DepdcFind = (DITFo_DepdcFind_tem_Rs1 | DITFo_DepdcFind_tem_Rs2 | DITFo_DepdcFind_tem_CS) ? 1'b1 : 1'b0;

//DITFo_DepdcFind_tem_Rs1
assign DITFo_DepdcFind_tem_Rs1 = (DITFi_Checken && (DITFi_CheckRs1en && 
							((DITFi_CheckRs1Index == r_DITF_data_0[24:20] && r_DITF_data_0[25] == 1'b1 && DIFT_MASK[1]) || 
							 (DITFi_CheckRs1Index == r_DITF_data_1[24:20] && r_DITF_data_1[25] == 1'b1 && DIFT_MASK[2]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_2[24:20] && r_DITF_data_2[25] == 1'b1 && DIFT_MASK[3]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_3[24:20] && r_DITF_data_3[25] == 1'b1 && DIFT_MASK[4]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_4[24:20] && r_DITF_data_4[25] == 1'b1 && DIFT_MASK[5]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_5[24:20] && r_DITF_data_5[25] == 1'b1 && DIFT_MASK[6]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_6[24:20] && r_DITF_data_6[25] == 1'b1 && DIFT_MASK[7]) ||
							 (DITFi_CheckRs1Index == r_DITF_data_7[24:20] && r_DITF_data_7[25] == 1'b1 && DIFT_MASK[8])							 
							 ))) ? 1'b1 : 1'b0;

//DITFo_DepdcFind_tem_Rs2
assign DITFo_DepdcFind_tem_Rs2 = (DITFi_Checken && (DITFi_CheckRs2en && 
							((DITFi_CheckRs2Index == r_DITF_data_0[24:20] && r_DITF_data_0[25] == 1'b1 && DIFT_MASK[1]) || 
							 (DITFi_CheckRs2Index == r_DITF_data_1[24:20] && r_DITF_data_1[25] == 1'b1 && DIFT_MASK[2]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_2[24:20] && r_DITF_data_2[25] == 1'b1 && DIFT_MASK[3]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_3[24:20] && r_DITF_data_3[25] == 1'b1 && DIFT_MASK[4]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_4[24:20] && r_DITF_data_4[25] == 1'b1 && DIFT_MASK[5]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_5[24:20] && r_DITF_data_5[25] == 1'b1 && DIFT_MASK[6]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_6[24:20] && r_DITF_data_6[25] == 1'b1 && DIFT_MASK[7]) ||
							 (DITFi_CheckRs2Index == r_DITF_data_7[24:20] && r_DITF_data_7[25] == 1'b1 && DIFT_MASK[8])							 
							 ))) ? 1'b1 : 1'b0;

//DITFo_DepdcFind_tem_CS
assign DITFo_DepdcFind_tem_CS = (DITFi_Checken && (DITFi_CheckCSRen && 
							((DITFi_CheckCSRIndex == r_DITF_data_0[37:26] && r_DITF_data_0[25] == 1'b1 && DIFT_MASK[1]) || 
							 (DITFi_CheckCSRIndex == r_DITF_data_1[37:26] && r_DITF_data_1[25] == 1'b1 && DIFT_MASK[2]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_2[37:26] && r_DITF_data_2[25] == 1'b1 && DIFT_MASK[3]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_3[37:26] && r_DITF_data_3[25] == 1'b1 && DIFT_MASK[4]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_4[37:26] && r_DITF_data_4[25] == 1'b1 && DIFT_MASK[5]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_5[37:26] && r_DITF_data_5[25] == 1'b1 && DIFT_MASK[6]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_6[37:26] && r_DITF_data_6[25] == 1'b1 && DIFT_MASK[7]) ||
							 (DITFi_CheckCSRIndex == r_DITF_data_7[37:26] && r_DITF_data_7[25] == 1'b1 && DIFT_MASK[8])							 
							 ))) ? 1'b1 : 1'b0;


//---------------------------------------------------------------------------------------------------------							 
//----------------------------------Write Port Signal------------------------------------------------------

//DITFo_write_ready 
assign DITFo_write_ready = (DITF_cnt == 4'd8) ? 1'b0 : 1'b1;


//--------------------------------------------------------------------------------------------------------
//----------------------------------Read Port Signal-------------------------------------------------------

//DITFo_v
assign DITFo_v = (DITF_cnt == 4'd0) ? 1'b0 : 1'b1;

//DITFo_itag
assign DITFo_itag = (DITF_cnt == 4'd1 	? r_DITF_data_0[7:0]	:  8'd0) |
					(DITF_cnt == 4'd2 	? r_DITF_data_1[7:0]	:  8'd0) |
					(DITF_cnt == 4'd3 	? r_DITF_data_2[7:0]	:  8'd0) |
					(DITF_cnt == 4'd4 	? r_DITF_data_3[7:0]	:  8'd0) |
					(DITF_cnt == 4'd5 	? r_DITF_data_4[7:0]	:  8'd0) |
					(DITF_cnt == 4'd6 	? r_DITF_data_5[7:0]	:  8'd0) |
					(DITF_cnt == 4'd7 	? r_DITF_data_6[7:0]	:  8'd0) |
					(DITF_cnt == 4'd8 	? r_DITF_data_7[7:0]	:  8'd0) | 8'd0;

//DITFo_rs1index
assign DITFo_rs1index = (DITF_cnt == 4'd1 	? r_DITF_data_0[12:8]	:  5'd0) |
						(DITF_cnt == 4'd2 	? r_DITF_data_1[12:8]	:  5'd0) |
						(DITF_cnt == 4'd3 	? r_DITF_data_2[12:8]	:  5'd0) |
						(DITF_cnt == 4'd4 	? r_DITF_data_3[12:8]	:  5'd0) |
						(DITF_cnt == 4'd5 	? r_DITF_data_4[12:8]	:  5'd0) |
						(DITF_cnt == 4'd6 	? r_DITF_data_5[12:8]	:  5'd0) |
						(DITF_cnt == 4'd7 	? r_DITF_data_6[12:8]	:  5'd0) |
						(DITF_cnt == 4'd8 	? r_DITF_data_7[12:8]	:  5'd0) | 5'd0;

//DITFo_rs1en
assign DITFo_rs1en = (DITF_cnt == 4'd1 	? r_DITF_data_0[13]	:  1'd0) |
					 (DITF_cnt == 4'd2 	? r_DITF_data_1[13]	:  1'd0) |
					 (DITF_cnt == 4'd3 	? r_DITF_data_2[13]	:  1'd0) |
					 (DITF_cnt == 4'd4 	? r_DITF_data_3[13]	:  1'd0) |
					 (DITF_cnt == 4'd5 	? r_DITF_data_4[13]	:  1'd0) |
					 (DITF_cnt == 4'd6 	? r_DITF_data_5[13]	:  1'd0) |
					 (DITF_cnt == 4'd7 	? r_DITF_data_6[13]	:  1'd0) |
					 (DITF_cnt == 4'd8 	? r_DITF_data_7[13]	:  1'd0) | 1'd0;					

//DITFo_rs2index
assign DITFo_rs2index = (DITF_cnt == 4'd1 	? r_DITF_data_0[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd2 	? r_DITF_data_1[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd3 	? r_DITF_data_2[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd4 	? r_DITF_data_3[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd5 	? r_DITF_data_4[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd6 	? r_DITF_data_5[18:14]	:  5'd0) |
						(DITF_cnt == 4'd7 	? r_DITF_data_6[18:14]	:  5'd0) |
					    (DITF_cnt == 4'd8 	? r_DITF_data_7[18:14]	:  5'd0) | 5'd0;

//DITFo_rs2en                     
assign DITFo_rs2en = (DITF_cnt == 4'd1 	? r_DITF_data_0[19]	:  1'd0) |
					 (DITF_cnt == 4'd2 	? r_DITF_data_1[19]	:  1'd0) |
					 (DITF_cnt == 4'd3 	? r_DITF_data_2[19]	:  1'd0) |
					 (DITF_cnt == 4'd4 	? r_DITF_data_3[19]	:  1'd0) |
					 (DITF_cnt == 4'd5 	? r_DITF_data_4[19]	:  1'd0) |
					 (DITF_cnt == 4'd6 	? r_DITF_data_5[19]	:  1'd0) |
					 (DITF_cnt == 4'd7 	? r_DITF_data_6[19]	:  1'd0) | 
					 (DITF_cnt == 4'd8 	? r_DITF_data_7[19]	:  1'd0) | 1'd0;

//DITFo_rdindex
assign DITFo_rdindex = (DITF_cnt == 4'd1 	? r_DITF_data_0[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd2 	? r_DITF_data_1[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd3 	? r_DITF_data_2[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd4 	? r_DITF_data_3[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd5 	? r_DITF_data_4[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd6 	? r_DITF_data_5[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd7 	? r_DITF_data_6[24:20]	:  5'd0) |
					   (DITF_cnt == 4'd8 	? r_DITF_data_7[24:20]	:  5'd0) | 5'd0;

//DITFo_rden
assign DITFo_rden = (DITF_cnt == 4'd1 	? r_DITF_data_0[25]	:  1'd0) |
					(DITF_cnt == 4'd2 	? r_DITF_data_1[25]	:  1'd0) |
					(DITF_cnt == 4'd3 	? r_DITF_data_2[25]	:  1'd0) |
					(DITF_cnt == 4'd4 	? r_DITF_data_3[25]	:  1'd0) |
					(DITF_cnt == 4'd5 	? r_DITF_data_4[25]	:  1'd0) |
					(DITF_cnt == 4'd6 	? r_DITF_data_5[25]	:  1'd0) |
					(DITF_cnt == 4'd7 	? r_DITF_data_6[25]	:  1'd0) |
					(DITF_cnt == 4'd8 	? r_DITF_data_7[25]	:  1'd0) | 1'd0;	

//DITFo_csrindex
assign DITFo_csrindex = (DITF_cnt == 4'd1 	? r_DITF_data_0[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd2 	? r_DITF_data_1[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd3 	? r_DITF_data_2[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd4 	? r_DITF_data_3[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd5 	? r_DITF_data_4[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd6 	? r_DITF_data_5[37:26]	:  12'd0) |
						(DITF_cnt == 4'd7 	? r_DITF_data_6[37:26]	:  12'd0) |
					    (DITF_cnt == 4'd8 	? r_DITF_data_7[37:26]	:  12'd0) | 12'd0;

//DITFo_csren
assign DITFo_csren = (DITF_cnt == 4'd1 	? r_DITF_data_0[38]	:  1'd0) |
					 (DITF_cnt == 4'd2 	? r_DITF_data_1[38]	:  1'd0) |
					 (DITF_cnt == 4'd3 	? r_DITF_data_2[38]	:  1'd0) |
					 (DITF_cnt == 4'd4 	? r_DITF_data_3[38]	:  1'd0) |
					 (DITF_cnt == 4'd5 	? r_DITF_data_4[38]	:  1'd0) |
					 (DITF_cnt == 4'd6 	? r_DITF_data_5[38]	:  1'd0) |
					 (DITF_cnt == 4'd7 	? r_DITF_data_6[38]	:  1'd0) |
					 (DITF_cnt == 4'd8 	? r_DITF_data_7[38]	:  1'd0) | 1'd0;		

//DITFo_jmp
assign DITFo_jmp = (DITF_cnt == 4'd1 	? r_DITF_data_0[39]	:  1'd0) |
				   (DITF_cnt == 4'd2 	? r_DITF_data_1[39]	:  1'd0) |
				   (DITF_cnt == 4'd3 	? r_DITF_data_2[39]	:  1'd0) |
				   (DITF_cnt == 4'd4 	? r_DITF_data_3[39]	:  1'd0) |
				   (DITF_cnt == 4'd5 	? r_DITF_data_4[39]	:  1'd0) |
				   (DITF_cnt == 4'd6 	? r_DITF_data_5[39]	:  1'd0) |
				   (DITF_cnt == 4'd7 	? r_DITF_data_6[39]	:  1'd0) |
				   (DITF_cnt == 4'd8 	? r_DITF_data_7[39]	:  1'd0) | 1'd0;		
				   
//DITFo_InsAccessFlt
assign DITFo_InsAccessFlt = (DITF_cnt == 4'd1 	? r_DITF_data_0[40]	:  1'd0) |
					        (DITF_cnt == 4'd2 	? r_DITF_data_1[40]	:  1'd0) |
					        (DITF_cnt == 4'd3 	? r_DITF_data_2[40]	:  1'd0) |
					        (DITF_cnt == 4'd4 	? r_DITF_data_3[40]	:  1'd0) |
					        (DITF_cnt == 4'd5 	? r_DITF_data_4[40]	:  1'd0) |
					        (DITF_cnt == 4'd6 	? r_DITF_data_5[40]	:  1'd0) |
							(DITF_cnt == 4'd7 	? r_DITF_data_6[40]	:  1'd0) |
					        (DITF_cnt == 4'd8 	? r_DITF_data_7[40]	:  1'd0) | 1'd0;		

//DITFo_InsPageFlt
assign DITFo_InsPageFlt = (DITF_cnt == 4'd1 	? r_DITF_data_0[41]	:  1'd0) |
					      (DITF_cnt == 4'd2 	? r_DITF_data_1[41]	:  1'd0) |
					      (DITF_cnt == 4'd3 	? r_DITF_data_2[41]	:  1'd0) |
					      (DITF_cnt == 4'd4 	? r_DITF_data_3[41]	:  1'd0) |
					      (DITF_cnt == 4'd5 	? r_DITF_data_4[41]	:  1'd0) |
					      (DITF_cnt == 4'd6 	? r_DITF_data_5[41]	:  1'd0) |
						  (DITF_cnt == 4'd7 	? r_DITF_data_6[41]	:  1'd0) |
					      (DITF_cnt == 4'd8 	? r_DITF_data_7[41]	:  1'd0) | 1'd0;		

//DITFo_InsAddrMis
assign DITFo_InsAddrMis = (DITF_cnt == 4'd1 	? r_DITF_data_0[42]	:  1'd0) |
					      (DITF_cnt == 4'd2 	? r_DITF_data_1[42]	:  1'd0) |
					      (DITF_cnt == 4'd3 	? r_DITF_data_2[42]	:  1'd0) |
					      (DITF_cnt == 4'd4 	? r_DITF_data_3[42]	:  1'd0) |
					      (DITF_cnt == 4'd5 	? r_DITF_data_4[42]	:  1'd0) |
					      (DITF_cnt == 4'd6 	? r_DITF_data_5[42]	:  1'd0) |
						  (DITF_cnt == 4'd7 	? r_DITF_data_6[42]	:  1'd0) | 
					      (DITF_cnt == 4'd8 	? r_DITF_data_7[42]	:  1'd0) | 1'd0;		

//DITFo_illins
assign DITFo_illins = (DITF_cnt == 4'd1 	? r_DITF_data_0[43]	:  1'd0) |
					  (DITF_cnt == 4'd2 	? r_DITF_data_1[43]	:  1'd0) |
					  (DITF_cnt == 4'd3 	? r_DITF_data_2[43]	:  1'd0) |
					  (DITF_cnt == 4'd4 	? r_DITF_data_3[43]	:  1'd0) |
					  (DITF_cnt == 4'd5 	? r_DITF_data_4[43]	:  1'd0) |
					  (DITF_cnt == 4'd6 	? r_DITF_data_5[43]	:  1'd0) |
					  (DITF_cnt == 4'd7 	? r_DITF_data_6[43]	:  1'd0) |
					  (DITF_cnt == 4'd8 	? r_DITF_data_7[43]	:  1'd0) | 1'd0;		

//DITFo_mret
assign DITFo_mret = (DITF_cnt == 4'd1 	? r_DITF_data_0[44]	:  1'd0) |
					(DITF_cnt == 4'd2 	? r_DITF_data_1[44]	:  1'd0) |
					(DITF_cnt == 4'd3 	? r_DITF_data_2[44]	:  1'd0) |
					(DITF_cnt == 4'd4 	? r_DITF_data_3[44]	:  1'd0) |
					(DITF_cnt == 4'd5 	? r_DITF_data_4[44]	:  1'd0) |
					(DITF_cnt == 4'd6 	? r_DITF_data_5[44]	:  1'd0) |
					(DITF_cnt == 4'd7 	? r_DITF_data_6[44]	:  1'd0) |
					(DITF_cnt == 4'd8 	? r_DITF_data_7[44]	:  1'd0) | 1'd0;		

//DITFo_sret
assign DITFo_sret = (DITF_cnt == 4'd1 	? r_DITF_data_0[45]	:  1'd0) |
					(DITF_cnt == 4'd2 	? r_DITF_data_1[45]	:  1'd0) |
					(DITF_cnt == 4'd3 	? r_DITF_data_2[45]	:  1'd0) |
					(DITF_cnt == 4'd4 	? r_DITF_data_3[45]	:  1'd0) |
					(DITF_cnt == 4'd5 	? r_DITF_data_4[45]	:  1'd0) |
					(DITF_cnt == 4'd6 	? r_DITF_data_5[45]	:  1'd0) |
					(DITF_cnt == 4'd7 	? r_DITF_data_6[45]	:  1'd0) |
					(DITF_cnt == 4'd8 	? r_DITF_data_7[45]	:  1'd0) | 1'd0;		

//DITFo_ecall
assign DITFo_ecall = (DITF_cnt == 4'd1 	? r_DITF_data_0[46]	:  1'd0) |
					 (DITF_cnt == 4'd2 	? r_DITF_data_1[46]	:  1'd0) |
					 (DITF_cnt == 4'd3 	? r_DITF_data_2[46]	:  1'd0) |
					 (DITF_cnt == 4'd4 	? r_DITF_data_3[46]	:  1'd0) |
					 (DITF_cnt == 4'd5 	? r_DITF_data_4[46]	:  1'd0) |
					 (DITF_cnt == 4'd6 	? r_DITF_data_5[46]	:  1'd0) |
					 (DITF_cnt == 4'd7 	? r_DITF_data_6[46]	:  1'd0) |
					 (DITF_cnt == 4'd8 	? r_DITF_data_7[46]	:  1'd0) | 1'd0;		

//DITFo_ebreak
assign DITFo_ebreak = (DITF_cnt == 4'd1 	? r_DITF_data_0[47]	:  1'd0) |
					  (DITF_cnt == 4'd2 	? r_DITF_data_1[47]	:  1'd0) |
					  (DITF_cnt == 4'd3 	? r_DITF_data_2[47]	:  1'd0) |
					  (DITF_cnt == 4'd4 	? r_DITF_data_3[47]	:  1'd0) |
					  (DITF_cnt == 4'd5 	? r_DITF_data_4[47]	:  1'd0) |
					  (DITF_cnt == 4'd6 	? r_DITF_data_5[47]	:  1'd0) |
					  (DITF_cnt == 4'd7 	? r_DITF_data_6[47]	:  1'd0) |
					  (DITF_cnt == 4'd8 	? r_DITF_data_7[47]	:  1'd0) | 1'd0;		

//DITFo_system
assign DITFo_system = (DITF_cnt == 4'd1 	? r_DITF_data_0[48]	:  1'd0) |
					  (DITF_cnt == 4'd2 	? r_DITF_data_1[48]	:  1'd0) |
					  (DITF_cnt == 4'd3 	? r_DITF_data_2[48]	:  1'd0) |
					  (DITF_cnt == 4'd4 	? r_DITF_data_3[48]	:  1'd0) |
					  (DITF_cnt == 4'd5 	? r_DITF_data_4[48]	:  1'd0) |
					  (DITF_cnt == 4'd6 	? r_DITF_data_5[48]	:  1'd0) |
					  (DITF_cnt == 4'd7 	? r_DITF_data_6[48]	:  1'd0) |
					  (DITF_cnt == 4'd8 	? r_DITF_data_7[48]	:  1'd0) | 1'd0;	

//DITFo_fencevma
assign DITFo_fencevma = (DITF_cnt == 4'd1 	? r_DITF_data_0[49]	:  1'd0) |
					     (DITF_cnt == 4'd2 	? r_DITF_data_1[49]	:  1'd0) |
					     (DITF_cnt == 4'd3 	? r_DITF_data_2[49]	:  1'd0) |
					     (DITF_cnt == 4'd4 	? r_DITF_data_3[49]	:  1'd0) |
					     (DITF_cnt == 4'd5 	? r_DITF_data_4[49]	:  1'd0) |
					     (DITF_cnt == 4'd6 	? r_DITF_data_5[49]	:  1'd0) |
					     (DITF_cnt == 4'd7 	? r_DITF_data_6[49]	:  1'd0) |
					     (DITF_cnt == 4'd8 	? r_DITF_data_7[49]	:  1'd0) | 1'd0;	
					  
//DITFo_fencei
assign DITFo_fencei = (DITF_cnt == 4'd1 	? r_DITF_data_0[50]	:  1'd0) |
					   (DITF_cnt == 4'd2 	? r_DITF_data_1[50]	:  1'd0) |
					   (DITF_cnt == 4'd3 	? r_DITF_data_2[50]	:  1'd0) |
					   (DITF_cnt == 4'd4 	? r_DITF_data_3[50]	:  1'd0) |
					   (DITF_cnt == 4'd5 	? r_DITF_data_4[50]	:  1'd0) |
					   (DITF_cnt == 4'd6 	? r_DITF_data_5[50]	:  1'd0) |
					   (DITF_cnt == 4'd7 	? r_DITF_data_6[50]	:  1'd0) |
					   (DITF_cnt == 4'd8 	? r_DITF_data_7[50]	:  1'd0) | 1'd0;	
					  
//DITFo_fence
assign DITFo_fence = (DITF_cnt == 4'd1 	? r_DITF_data_0[51]	:  1'd0) |
					 (DITF_cnt == 4'd2 	? r_DITF_data_1[51]	:  1'd0) |
					 (DITF_cnt == 4'd3 	? r_DITF_data_2[51]	:  1'd0) |
					 (DITF_cnt == 4'd4 	? r_DITF_data_3[51]	:  1'd0) |
					 (DITF_cnt == 4'd5 	? r_DITF_data_4[51]	:  1'd0) |
					 (DITF_cnt == 4'd6 	? r_DITF_data_5[51]	:  1'd0) |
					 (DITF_cnt == 4'd7 	? r_DITF_data_6[51]	:  1'd0) |
					 (DITF_cnt == 4'd8 	? r_DITF_data_7[51]	:  1'd0) | 1'd0;	
					  
endmodule

